package Renderer.HTMLDrawer;
import Tree.Node;
import Renderer.*;
import Errors.ErrorLog;
/**
 * This is an abstact class, the subclasses of which will draw onto the page.
 * @author Nathan Scully
 * @version FINAL
 */
public abstract class Drawer
{
    protected Node node;
    protected HTMLRenderer renderer;
    protected ErrorLog errorLog;
    protected Stack stack;

    /**
     * The Constuctor to be called by the Renderer during tree traversal. Sets 
     * the error log, TextProperty stack and the renderer object, as well as the 
     * current Node that this Drawer corresponds to.
     * @param node The Node that this Drawer will draw.
     * @param renderer The current Renderer.
     */
    public Drawer(Node node, HTMLRenderer renderer)
    {
        this.node = node;
        this.renderer = renderer;
        errorLog = renderer.getErrors();
        stack = renderer.getStack();
    }

    /**
     * Abstract method to be overwritten. Must be overwritten.
     */
    public abstract void draw();

    /**
     * Abstract method to be overwritten. Only if necessary.
     */
    public void postProcess() {}

    /**
     * This will call newLine() in renderer; this is to be used by any subclass.
     */
    protected void newLine()
    {
        renderer.newLine();
    }
}
